package org.nod.atgm.gameobjects;

import com.threed.jpct.SimpleVector;


public abstract class MovingObject extends PrecompiledGameObject {

	protected SimpleVector speedVector;
	protected IPropeller propeller;
	
	protected float scalarSpeed;

	public SimpleVector getSpeedVector() {
		return speedVector;
	}

	public void setSpeedVector(SimpleVector speedVector) {
		this.speedVector = speedVector;
	}

	public float getScalarSpeed() {
		return scalarSpeed;
	}

	public void setScalarSpeed(float scalarSpeed) {
		this.scalarSpeed = scalarSpeed;
	}
	
	@Override
	public void handleTimer(int time) {
		if (propeller != null)
			propeller.handleTimer(time);
		else {
			float multiplicator = scalarSpeed * time;
	
			float x = speedVector.x * multiplicator;
			float y = speedVector.y * multiplicator;
			float z = speedVector.z * multiplicator;
			translate(x,y,z);
		}
	}

	public IPropeller getPropeller() {
		return propeller;
	}

	public void setPropeller(IPropeller propeller) {
		this.propeller = propeller;
	}
	
}
